package com.atguigu.consumer;

import com.atguigu.constant.KafkaConstant;
import com.atguigu.service.KafkaService;
import com.atguigu.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class OrderConsumer {
    @Autowired
    private OrderInfoService orderInfoService;

    @KafkaListener(topics = KafkaConstant.QUEUE_ORDER_CANCEL)
    public void cancelOrder(Long orderId){
        if(orderId != null){
            orderInfoService.cancelOrder(orderId);
        }
    }

}
